<template>
  <div>
    <ul>
      <li v-for="(item, index) in num" :key="item">
        {{ item }}-{{ index }}
        <!-- 数组的索引号 -->
        <button @click="num.splice(index, 1)">删除</button>
      </li>
    </ul>
    <button @click="randerNum">生成</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      num: [],
    };
  },
  methods: {
    randerNum() {
      this.num.push(Math.floor(Math.random() * 100 + 1));
    },
  },
};
</script>

<style>
</style>